<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_account', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('sdk官方账号');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->char('openid', 32)->comment('系统生成的账号唯一id')->default('');
            $table->char('account', 32)->comment('账号')->default('');
            $table->string('password', 512)->comment('密码')->default('');
            $table->string('nickname', 32)->comment('昵称')->default('');
            $table->char('phone', 11)->comment('绑定手机号')->default('');
            $table->string('email', 32)->comment('邮箱')->default('');
            $table->string('ip', 32)->comment('注册ip')->default('');

            $table->index('create_time');
            $table->index('openid');
            $table->unique('account');
            $table->index('phone');
            $table->index('email');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_account');
    }
};
